home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performImportClipToChar.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  6.9 KB  |  294 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  August 2001
  22. //
  23. //  Description:
  24. //      This script is the import clip to character option box dialog.
  25. //
  26. //  Input Arguments:
  27. //      None.
  28. //
  29. //  Return Value:
  30. //      None.
  31. //
  32.  
  33. proc setOptionVars (int $forceFactorySettings)
  34. {
  35.     // import clip to timeline
  36.     //
  37.     if ($forceFactorySettings || !`optionVar -exists ImportClipToTimeline`) {
  38.         optionVar -intValue ImportClipToTimeline 1;
  39.     }
  40.  
  41. }
  42.  
  43. //
  44. //  Procedure Name:
  45. //      ImportClipToCharSetup
  46. //
  47. //  Description:
  48. //        Update the state of the option box UI to reflect the option values.
  49. //
  50. //  Input Arguments:
  51. //      parent               - Top level parent layout of the option box UI.
  52. //                             Required so that UI object names can be 
  53. //                             successfully resolved.
  54. //
  55. //    forceFactorySettings     - Whether the option values should be set to
  56. //                             default values.
  57. //
  58. //  Return Value:
  59. //      None.
  60. //
  61. global proc ImportClipToCharSetup (string $parent, int $forceFactorySettings)
  62. {
  63.     // Retrieve the option settings
  64.     //
  65.     setOptionVars( $forceFactorySettings );
  66.  
  67.     setParent $parent;
  68.     
  69.     // import to timeline
  70.     //
  71.     int $toTimeline = `optionVar -query ImportClipToTimeline`;
  72.     if ($toTimeline) {
  73.         radioButtonGrp -e -sl 1 scheduleMethod;
  74.     } else {
  75.         radioButtonGrp -e -sl 1 moveToLibraryMethod;
  76.     }
  77. }
  78.  
  79. //
  80. //  Procedure Name:
  81. //      ImportClipToCharCallback
  82. //
  83. //  Description:
  84. //        Update the option values with the current state of the option box UI.
  85. //
  86. //  Input Arguments:
  87. //      parent - Top level parent layout of the option box UI.  Required so
  88. //               that UI object names can be successfully resolved.
  89. //
  90. //    doIt       - Whether the command should execute.
  91. //
  92. //  Return Value:
  93. //      None.
  94. //
  95. global proc ImportClipToCharCallback (string $parent, int $doIt)
  96. {
  97.     setParent $parent;
  98.  
  99.     if (`radioButtonGrp -q -sl scheduleMethod` == 1) {    
  100.         optionVar -intValue ImportClipToTimeline 1;
  101.     } else {
  102.         optionVar -intValue ImportClipToTimeline 0;        
  103.     }
  104.     
  105.     if ($doIt)
  106.     {    
  107.         performImportClipToChar false; 
  108.         addToRecentCommandQueue "performImportClipToChar false" "ImportClipToChar";
  109.     }
  110. }
  111.  
  112.  
  113. proc string ImportClipToCharWidgets( string $parent )
  114. {
  115.     setParent $parent;
  116.     
  117.     string $tabForm = `columnLayout -adjustableColumn true`;
  118.  
  119.     radioButtonGrp -numberOfRadioButtons 1
  120.         -label "Clip"
  121.         -label1 "Put Clip in Visor Only"
  122.         -annotation "Put Clip in Visor Only: The clip is put in the Visor for later use."
  123.         moveToLibraryMethod;
  124.  
  125.     radioButtonGrp -numberOfRadioButtons 1
  126.         -label1 "Put Clip in Trax Editor and Visor"
  127.         -annotation "Put Clip in Trax Editor and Visor: The clip is placed in the Trax editor for immediate use. The clip is also put in the Visor for later use."        
  128.         -shareCollection moveToLibraryMethod
  129.         scheduleMethod;
  130.  
  131.     return $tabForm;
  132. }
  133.  
  134. global proc ImportClipToCharOptions ()
  135. {
  136.     string $commandName = "ImportClipToChar";
  137.  
  138.     string $applyTitle = "Create";
  139.     
  140.     // Build the option box "methods"
  141.     //
  142.     string $callback = ($commandName + "Callback");
  143.     string $setup = ($commandName + "Setup");
  144.  
  145.     //    Get the option box.
  146.     //
  147.     //  The value returned is the name of the layout to be used as
  148.     //    the parent for the option box UI.
  149.     //
  150.     string $layout = getOptionBox();
  151.     setParent $layout;
  152.  
  153.     setOptionBoxCommandName("clip");
  154.  
  155.     setUITemplate -pushTemplate DefaultTemplate;
  156.     waitCursor -state 1;
  157.     tabLayout -scr true -tv false;    // To get the scroll bars
  158.  
  159.     string $parent = `columnLayout -adjustableColumn 1`;
  160.  
  161.     ImportClipToCharWidgets $parent;
  162.  
  163.     waitCursor -state 0;
  164.     setUITemplate -popTemplate;
  165.  
  166.     //    'Apply' button.
  167.     //
  168.     string $applyBtn = getOptionBoxApplyBtn();
  169.     button -edit
  170.         -label "Import Clip"
  171.         -command ($callback + " " + $parent + " " + 1)
  172.         $applyBtn;
  173.  
  174.     //    'Save' button.
  175.     //
  176.     string $saveBtn = getOptionBoxSaveBtn();
  177.     button -edit 
  178.         -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
  179.         $saveBtn;
  180.  
  181.     //    'Reset' button.
  182.     //
  183.     string $resetBtn = getOptionBoxResetBtn();
  184.     button -edit 
  185.         -command ($setup + " " + $parent + " " + 1)
  186.         $resetBtn;
  187.  
  188.     //    Set the option box title.
  189.     //
  190.     setOptionBoxTitle("Import Clip To Character Options");
  191.  
  192.     //    Customize the 'Help' menu item text.
  193.     //
  194.     setOptionBoxHelpTag( "Import Clip" );
  195.  
  196.     //    Set the current values of the option box.
  197.     //
  198.     eval (($setup + " " + $parent + " " + 0));    
  199.     
  200.     //    Show the option box.
  201.     //
  202.     showOptionBox();
  203. }
  204.  
  205.  
  206. //
  207. //  Procedure Name:
  208. //      assembleCmd
  209. //
  210. //  Description:
  211. //        Construct the command that will apply the option box values.
  212. //
  213. //  Input Arguments:
  214. //      None.
  215. //
  216. //  Return Value:
  217. //      None.
  218. //
  219. proc string assembleCmd()
  220. {
  221.     string $cmd;
  222.  
  223.     setOptionVars(false);
  224.  
  225.     // check whether to schedule the clip
  226.     int $toTimeline = 1;
  227.     if (`optionVar -exists ImportClipToTimeline`) {
  228.         $toTimeline = `optionVar -query ImportClipToTimeline`;
  229.     }
  230.     
  231.     // doImportClipArgList takes a string array 
  232.     //
  233.     $cmd =    "doImportClipArgList 3 { " +
  234.         "\"1\"" +
  235.         ",\"" + $toTimeline + "\"" +                
  236.         " };";
  237.  
  238.     return $cmd;
  239. }
  240.  
  241. //
  242. //  Procedure Name:
  243. //      performImportClipToChar
  244. //
  245. //  Description:
  246. //        Import the clip.  This procedure will also show the option box
  247. //        window if necessary as well as construct the command string
  248. //        that will import the clip with the current option box values.
  249. //
  250. //  Input Arguments:
  251. //      0 - Execute the command.
  252. //      1 - Show the option box dialog.
  253. //      2 - Return the command.
  254. //
  255. //  Return Value:
  256. //      None.
  257. //
  258. global proc string performImportClipToChar (int $action)
  259. {
  260.     string $cmd = "";
  261.  
  262.     switch ($action) {
  263.  
  264.         //    Execute the command.
  265.         //
  266.         case 0:
  267.             //    Retrieve the option settings
  268.             //
  269.             setOptionVars(false);
  270.  
  271.             //    Get the command.
  272.             //
  273.             $cmd = `assembleCmd`;
  274.  
  275.             //    Execute the command with the option settings.
  276.             //
  277.             evalEcho($cmd);
  278.  
  279.             break;
  280.  
  281.         //    Show the option box.
  282.         //
  283.         case 1:
  284.             ImportClipToCharOptions;
  285.             break;
  286.         case 2:
  287.             //    Get the command.
  288.             //
  289.             $cmd = `assembleCmd`;
  290.     }
  291.     return $cmd;
  292. }
  293.  
  294.